package cn.yunhe.service.impl;

import cn.yunhe.dao.RedPackageDao;
import cn.yunhe.model.RedPacket;
import cn.yunhe.service.RedPackageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by zs on 2018/1/5.
 */
@Service
public class RedPackageServiceImpl implements RedPackageService {

    @Autowired
    private RedPackageDao redPackageDao = null;

    @Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED)
    public RedPacket getRedPackage(Long id) {
        return redPackageDao.getRedPackage(id);
    }

    @Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED)
    public int decreaseRedPackage(Long id) {
        return redPackageDao.decreaseRedPackage(id);
    }
}
